package it.em.iBet.commons;

import it.em.persistance.bo.Stock;
import it.em.persistance.bo.StockBo;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Application {
	
	 public static void main( String[] args )
	    {
	    	ApplicationContext appContext = 
	    	  new ClassPathXmlApplicationContext("config/BeanLocations.xml");
	 
	    	StockBo stockBo = (StockBo)appContext.getBean("stockBo");
	 
	    	/** insert **/
	    	Stock stock = new Stock();
	    	stock.setStockCode("7668");
	    	stock.setStockName("HAIO");
	    	stockBo.save(stock);
	 
	    	/** select **/
	    	Stock stock2 = stockBo.findByStockCode("7668");
	    	System.out.println(stock2);
	 
	    	/** update **/
	    	stock2.setStockName("HAIO-1");
	    	stockBo.update(stock2);
	 
	    	System.out.println("Done");
	    }

}
